
#if !defined(AFX_SPLITTERCONTROL_H__FEBBA242_B2C9_4403_B68D_E519D645CB15__INCLUDED_)
#define AFX_SPLITTERCONTROL_H__FEBBA242_B2C9_4403_B68D_E519D645CB15__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SplitterControl.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CSplitterControl window
#define SPN_SIZED WM_USER + 1

#define CW_LEFTALIGN		1
#define CW_RIGHTALIGN		2
#define CW_TOPALIGN			3
#define CW_BOTTOMALIGN		4

#define SPS_VERTICAL		1
#define SPS_HORIZONTAL		2

#define BOUNDARY_CENTER		1
#define BOUNDARY_SIDELINE	2

typedef struct SPC_NMHDR
{
	NMHDR hdr;
	int delta;
} SPC_NMHDR;

class CSplitterControl : public CStatic
{
public:
	CSplitterControl();

protected:
	BOOL m_bIsPressed;
	int m_nType;
	int m_nX, m_nY;
	int	m_nMin, m_nMax;
	int m_nSavePos;		// Save point on the lbutton down 
	int m_nDownSub, m_nUpAdd;
	int m_nBoundaryType;

public:
	static void ChangePos(CWnd* pWnd, int dx, int dy);
	static void ChangeWidth(CWnd* pWnd, int dx, DWORD dwFlag = CW_LEFTALIGN);
	static void ChangeHeight(CWnd* pWnd, int dy, DWORD dwFlag = CW_TOPALIGN);
public:
	void SetBoundaryByCenter(int nMin, int nMax);
	void SetBoundaryByCenter(int nSubtraction, int nAddition, int nRoot);
	void SetBoundaryBySideLine(int nDownSub, int nUpAdd);

	int GetStyle();
	int	SetStyle(int nStyle = SPS_VERTICAL);
	void Create(DWORD dwStyle, const CRect& rect, CWnd* pParent, UINT nID);
	virtual ~CSplitterControl();

protected:
	virtual void DrawLine(CDC* pDC, int x, int y);
	void MoveWindowTo(CPoint pt);
	void GetSideLineBoundary();
	
	afx_msg void OnPaint();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);

	DECLARE_MESSAGE_MAP()
};


#endif
